const App = require("../models/product")

const kkk = (num)=>{
    switch (num) {
        case 1:
            return "平方";
        case 2:
            return "个";
        case 3:
            return "扇";
        case 4:
            return "套";
        case 5:
            return "米";
        case 7:
            return "支";
        case 8:
            return "把";
        case 9:
            return "片";
        case 10:
            return "粒";
        case 11:
            return "件";
        default:
            return "未知";
    }

}

const gg = async ()=>{
    // const res = await App.find({'series.0':{$exists:1}})
    // //searchInfo.value['series.0'] = {$exists:0}
    // //console.log(res) 
    // for(let i=0;i<res.length;i++){
    //     let item = res[i]
    //     if(item.unit){
    //         const unitName =  kkk(item.unit)
    //         await App.findByIdAndUpdate(item._id, { unitName }) 
    //     }
        
    // }

    const res = await App.updateMany({'series.0':{$exists:1}},{sortNum:1})
  // const res = await App.updateMany({},{sortNum:2})
}

gg()